
package ch.hearc.coursJava.IO.RMI.exemple0.pcB.use;

import java.rmi.Remote;
import java.rmi.RemoteException;

import ch.hearc.coursJava.IO.RMI.exemple0.pcA.moo.Horloge;
import ch.hearc.coursJava.IO.RMI.exemple0.pcA.moo.Horloge_I;
import ch.hearc.coursJava.IO.RMI.exemple0.pcB.moo.Secret;

import com.bilat.tools.reseau.rmi.RmiTools;

public class UsePcB
	{

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	public static void main(String[] args)
		{
		main();
		}

	public static void main()
		{
		serveur();
		client();
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private static void serveur()
		{
		try
			{
			Secret secret = new Secret();
			}
		catch (RemoteException e)
			{
			e.printStackTrace();
			}
		}

	private static void client()
		{
		try
			{
			Remote remote = RmiTools.connectionRemoteObjectBloquant(Horloge.IP.getHostName(), Horloge.ID, Horloge.PORT);
			Horloge_I horloge = (Horloge_I)remote;

			System.out.println(horloge.getTime().toString());
			}
		catch (Exception e)
			{
			e.printStackTrace();
			}
		}
	}
